package com.ruoyi.supervise.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.supervise.domain.CompletionRecordInfoTable;
import com.ruoyi.supervise.mapper.CompletionRecordInfoTableMapper;
import com.ruoyi.supervise.service.ICompletionRecordInfoTableService;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;

/**
 * @ClassName: CompletionRecordInfoTableServiceImpl
 * @Description: 竣工备案审查记录table的serviceimpl
 * @Author wtj
 * @DateTime 2020年4月15日 下午2:39:47
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class CompletionRecordInfoTableServiceImpl implements ICompletionRecordInfoTableService 
{
    @Autowired
    private CompletionRecordInfoTableMapper completionRecordInfoTableMapper;

	@Override
	public List<CompletionRecordInfoTable> selectCompletionRecordInfoTable(CompletionRecordInfoTable crit) {
		if(StringUtils.isEmpty(crit.getBeginReportTime()) && !StringUtils.isEmpty(crit.getEndReportTime())) {
			crit.setBeginReportTime("1970-01-01");
		}else if(!StringUtils.isEmpty(crit.getBeginReportTime()) && StringUtils.isEmpty(crit.getEndReportTime())) {
			crit.setEndReportTime(DateUtil.format(new Date(), DatePattern.NORM_DATE_PATTERN));
		}
		return completionRecordInfoTableMapper.selectCompletionRecordInfoTable(crit);
	}
}
